import {createRouter, createWebHistory} from "vue-router";
import {ElMessage} from "element-plus";

import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; // 引入样式
const routes = [
    {
        path: "/",
        name: "home",
        component: () => import("../views/home.vue"),
        redirect: 'tabus/index',
        children: [
            {
                path: "tabus/index",
                name: "index",
                component: () => import("../views/index.vue"),
            },
            {
                path: "tabus/myIndex",
                name: "myIndex",
                component: () => import("../views/my/index.vue"),
            },{
                path: "tabus/classroom-analysis",
                name: "classroomAnalysis",
                component: () => import("../views/classroomAnalysis/index.vue"),
            },{
                path: "tabus/classroom-analysis-records",
                name: "classroomAnalysisRecords",
                component: () => import("../views/classroomAnalysis/record.vue"),
            },
            {
                path: "tabus/teacher-manage",
                name: "teacherManage",
                component: () => import("../views/course-manage/teacher-manage.vue"),
            },
            {
                path: "tabus/class-manage",
                name: "classManage",
                component: () => import("../views/course-manage/class-manage.vue"),
            },
            {
                path: "tabus/course-manage",
                name: "courseManage",
                component: () => import("../views/course-manage/course-manage.vue"),
            },
            {
                path: "tabus/class-analysis",
                name: "class-analysis",
                component: () => import("../views/data-analysis/class-analysis/index.vue"),
            },
            {
                path: "tabus/class-analysis/:id",
                name: "class-analysis-detail",
                component: () => import("../views/data-analysis/class-analysis/detail.vue"),
            },
            {
                path: "tabus/teacher-analysis",
                name: "teacher-analysis",
                component: () => import("../views/data-analysis/teacher-analysis/index.vue"),
            },
            {
                path: "tabus/teacher-analysis/:id",
                name: "teacher-analysis-detail",
                component: () => import("../views/data-analysis/teacher-analysis/detail.vue"),
            },
            {
                path: "tabus/classroom-feedback",
                name: "classroom-feedback",
                component: () => import("../views/classroomAnalysis/feedback.vue"),
            }
        ]
    },
];
NProgress.configure({
    easing: 'ease', // 动画方式
    speed: 400, // 递增进度条的速度
    showSpinner: false, // 是否显示加载ico
    trickleSpeed: 200, // 自动递增间隔
    minimum: 0.3 // 初始化时的最小百分比
})
NProgress.configure({showSpinner: true}) // 显示右上角螺旋加载提示

const router = createRouter({
    history: createWebHistory(),
    routes,
});
router.beforeEach((to, from, next) => {
    NProgress.start();
    next();
});
router.afterEach(() => {
    NProgress.done()
})
export default router;
